import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
testCase = "DBshop019_添加属性"

# 调用函数 实例化浏览器对象 打开指定网址
driver = openBrowser(urlAdmin)
# 调用函数登录后台
DBshopLoginAdmin(driver)
# 处理三级菜单
DBshopEnterMenu3(driver,'商品管理','商品属性','属性')
driver.find_element_by_partial_link_text("添加属性").click()
time.sleep(2)
driver.find_element_by_xpath("//*[@id = 'attribute_group_id']/option[2]").click()
driver.find_element_by_id("attribute_name").send_keys(shuxing)
driver.find_element_by_id("attribute_sort").clear()
driver.find_element_by_id("attribute_sort").send_keys("255")
driver.find_element_by_xpath("//button").click()

try:
    driver.find_element_by_xpath('//td[contains(.,"%s")]'%shuxing).is_displayed()
    writeLog("%s 测试通过"%testCase)
except:
    writeLog("%s 测试失败" % testCase)
    getPhoto(driver)
driver.quit()
